package com.forum.model.pojo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "post")
@SequenceGenerator(name = "sequence", sequenceName = "post_id_seq", allocationSize = 1)
public class Post implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence")
	@Column(name = "id")
	private Long id;

	@Column(name = "postowner", nullable = false)
	private Long postOwner;
	
	@Transient
	private ForumUser poster;

	@Column(name = "topic", nullable = false)
	private Long topic;

	@Column(name = "title")
	private String title;

	@Column(name = "description")
	private String description;

	@Column(name = "content", nullable = false)
	private String content;

	@Column(name = "startdate", nullable = false)
	private Date startDate;

	@Column(name = "modifydate", nullable = false)
	private Date modifyDate;

	public Post() {
	}

	public Post(String content, Date startDate, Date modifyDate, Long postOwner,
			Long topic) {
		this.content = content;
		this.startDate = startDate;
		this.modifyDate = modifyDate;
		this.postOwner = postOwner;
		this.topic = topic;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Long getPostOwner() {
		return postOwner;
	}

	public void setPostOwner(Long postOwner) {
		this.postOwner = postOwner;
	}

	public Long getTopic() {
		return topic;
	}

	public void setTopic(Long topic) {
		this.topic = topic;
	}

	public ForumUser getPoster() {
		return poster;
	}

	public void setPoster(ForumUser poster) {
		this.poster = poster;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}

	public Date getStartDate() {
		return startDate;
	}

	public Date getModifyDate() {
		return modifyDate;
	}
}